<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0,user-scalable=no">
    <title>门店转让</title>
    <link rel="stylesheet" href="css/vant.css">
    <link rel="stylesheet" href="css/changeShop.css">
</head>

<body>
    <div id="app" v-cloak>
        <div class="inputBox">
            <div>
                <span>用户id</span>
                <input type="text" v-model="userId" placeholder="请输入要转店铺的用户id">
            </div>
            <div>
                <span>门店id</span>
                <input type="text" v-model="shopId" placeholder="请输入用户将要转入的1店铺id">
            </div>
            <div>
                <span>操作人</span>
                <input type="text" v-model="person" placeholder="请输入操作人姓名">
            </div>
            <div>
                <span>转店原因</span>
                <input type="text" v-model="reason" placeholder="请输入转店铺的原因">
            </div>
        </div>

        <div class="btnBox" @click="submitHandle">
            <div>提交</div>
        </div>
        <div class="loading" v-if="isShow">
            <img src="./img/load.gif" alt="">
        </div>

    </div>
    <script src="js/vue.min.js"></script>
    <script src="js/flex_ible/lib-flexible.js"></script>
    <script src="js/vue-lazyload.js"></script>
    <script src="js/vant.min.js"></script>
    <script src="js/vue-lazyload.js"></script>
    <script src="js/url.js" type="text/javascript" charset="utf-8"></script>
    <script src="js/ajax.js"></script>
    <script type="text/javascript" src="http://res2.wx.qq.com/open/js/jweixin-1.6.0.js"></script>
    <script>


        Vue.use(VueLazyload);
        var vm = new Vue({
            el: "#app",
            data: {
                isShow: false,
                userId: '',
                shopId: '',
                person: '',
                reason: '',
            },
            created() {

            },
            methods: {
                submitHandle() {
                    if (this.userId == '') {
                        vant.Toast('请输入要转店铺的用户id');
                        return
                    } else if (this.shopId == '') {
                        vant.Toast('请输入用户将要转入的店铺id');
                        return
                    } else if (this.person == '') {
                        vant.Toast('请输入操作人姓名');
                        return
                    } else if (this.reason == '') {
                        vant.Toast('请输入转店铺的原因');
                        return
                    }

                    console.log(this.userId);
                    console.log(this.shopId);
                    console.log(this.person);
                    console.log(this.reason);
                    var that = this;
                    that.isShow = true
                    ajax({
                        type: "post",
                        url: newUrl + "user/updateUserShop",
                        data: {
                            userId: that.userId,
                            shopId: that.shopId,
                            caozuoren: that.person,
                            changeUserRecordReason: that.reason,
                        },
                        dataType: 'json',
                        timeout: 10000,
                        contentType: "application/json",
                        success: function (res) {
                            var res = JSON.parse(res)
                            if (res.flag) {
                                alert('操作成功')
                            } else {
                                alert('操作失败，请重试')
                            }
                            that.isShow = false
                        },
                    })
                },
            }
        })
    </script>

</body>

</html>